package meijuli.com.join51.business.utils;

import android.text.TextUtils;

/**
 * 请描述使用该类使用方法！！！
 *
 * @author wenqin 2017-05-09 10:29
 */

public class BankUtils {

    public static String getBankCard(String bankCardNum) {
        String bankCard = bankCardNum;
        if (!TextUtils.isEmpty(bankCard) && bankCard.length() > 12) {
            bankCard = bankCard.replaceAll(bankCard.substring(4, bankCard.length() - 4),
                    "  ****  ****  ");
        }
        return bankCard;
    }

    public static String getRealName(String realName) {
        String name = realName;
        if (!TextUtils.isEmpty(name) && name.length() > 1) {
            String endName = name.substring(1, name.length());
            name = name.substring(0, 1) + endName.replace(endName, getReplaceStr(endName.length()));
        }
        return name;
    }

    private static CharSequence getReplaceStr(int length) {
        String result = "";
        for (int i = 0; i < length; i++) {
            result += "*";
        }
        return result;
    }
}
